package com.cy.controller;

import com.cy.service.RemoteProviderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author tang
 * @data 2021/9/16
 * @apiNode
 */
@RestController
public class FeignConsumerController {
    @Autowired
    private RemoteProviderService remoteProviderService;

    /**
     * 执行远程服务掉i用
     * 访问brwoser->consumer->provider
     * 1)brwoser
     * http://localhost:8090/consumer/echo4/nanami
     * 2)consumer
     * http://sca-provider/provider/echo4/nanami
     * @param msg
     * @return
     */
    @GetMapping("/consumer/echo4/{msg}")
    public String doRestEcho(@PathVariable String msg){
        return remoteProviderService.echoMessage(msg);
    }
}
